<table class="ui celled striped table">
    <thead>
      <tr>
        <th>Issue</th>
        <th>Items</th>
        <th>Ads</th>
        <th>Create Time</th>
        <th>Update Time</th>
        <th>Publish Time</th>
        <th></th>
      </tr>
    </thead>

    <tbody>
    <%= for issue <- @issues do %>
      <tr>
        <td>
          <%= link issue.slug, to: ~p"/admin/news/issues/#{issue}/edit" %>
        </td>
        <td><%= item_count(issue) %></td>
        <td><%= ad_count(issue) %></td>
        <td><%= AdminHelpers.ts(issue.inserted_at) %></td>
        <td><%= AdminHelpers.ts(issue.updated_at) %></td>
        <td><%= AdminHelpers.ts(issue.published_at) %></td>
        <td class="center aligned">
          <div class="ui small basic buttons">
            <%= AdminHelpers.icon_link("eye", to: Routes.news_issue_path(@conn, show_or_preview(issue), issue.slug)) %>
            <%= AdminHelpers.icon_link("edit", to: ~p"/admin/news/issues/#{issue}/edit") %>
            <%= AdminHelpers.icon_link("trash", to: Routes.admin_news_issue_path(@conn, :delete, issue), method: :delete, data: [confirm: "Are you sure?"]) %>
          </div>
        </td>
      </tr>
    <% end %>
    </tbody>
  </table>
